package cn.yuan.util.AjaxResult;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class AjaxResult {
    private Boolean success = true;
    private String msg = "操作成功";
    /*拓展：如果需要返回其他对象*/
    private Object resultObj;

    /*提供静态方法：获取对象*/
    public static AjaxResult me(){

        return new AjaxResult();
    }

    /*拓展链式语法*/
    public AjaxResult setSuccess(Boolean success){
        this.success = success;
        return this;
    }

    public AjaxResult setMsg(String msg){
        this.msg = msg;
        return this;
    }

    public Boolean getSuccess() {
        return success;
    }

    public String getMsg() {
        return msg;
    }

    public Object getResultObj() {
        return resultObj;
    }

    public AjaxResult setResultObj(Object resultObj) {
        this.resultObj = resultObj;
        return this;
    }

}
